function [f, g, h]= L_sigma_1(x, model, n)

% global model;
% global n;
k=model.k;

x=x';

term1 = -sum((x)./(2*model.sigma_01.^2));
term2 = (1/2)*sum(log(2*pi*x));
term3 = -sum(((model.eta.^2)*(x)')'./(2*model.sigma_02.^2));
term3 = term3*(model.lambda^2);
term4 = -(model.r1/model.zeta_1(n))*sum(exp(model.alpha_1(n,:)+x/2));

f     = -(term1+term2+term3+term4);


if(nargout>1)
   
 term11 = -1./(2*model.sigma_01.^2);
 term12 = (1./(2*x));
 term13 = -sum(((model.eta.^2))./(2*repmat((model.sigma_02.^2)',1,k)),1);
 term13 = term13*(model.lambda^2);
 term14 = -(model.r1/(2*model.zeta_1(n)))*exp(model.alpha_1(n,:)+x/2);

 g      = -(term11+term12+term13+term14)';
 
 
  if(nargout>2)
    
   term21 = -(1./(2*x.^2));
   term22 = -(model.r1/(4*model.zeta_1(n)))*exp(model.alpha_1(n,:)+x/2);
 
   h      = -diag(term21 + term22);
  end

end





end
